$(function() {
	document.querySelector("body > div.logoAndSearch.w1190.textWarp > div.logo > a").href="../index.html";
	//头部显示
	let userName = localStorage.getItem("currentLoginUser.aomall.com");
	document.getElementsByClassName("user")[0].children[0].target="_self";
	document.getElementsByClassName("user")[0].children[2].target="_self";
	if(userName!==null&&userName!=="")
	{
		document.getElementsByClassName("user")[0].children[0].href="javascript:void(0);";
		document.getElementsByClassName("user")[0].children[2].href="javascript:unLoad();";
		document.getElementsByClassName("user")[0].children[0].innerText = "欢迎您 "+userName+" !";
		document.getElementsByClassName("user")[0].children[2].innerText = "注销";
		console.log(1);
	}
	else
	{
		document.getElementsByClassName("user")[0].children[0].href="../login.html";
		document.getElementsByClassName("user")[0].children[2].href="../register.html";
		document.getElementsByClassName("user")[0].children[0].innerText = "登录";
		document.getElementsByClassName("user")[0].children[2].innerText = "免费注册";
		console.log(0);
	}

	//设置订单跳转
	document.getElementsByClassName("persontab")[0].children[0].firstChild.href="Member-allOrder.html";
	document.getElementsByClassName("persontab")[0].children[1].firstChild.href="Member-NoPay.html";
	document.getElementsByClassName("persontab")[0].children[2].firstChild.href="Member-qingguan.html";
	document.getElementsByClassName("persontab")[0].children[3].firstChild.href="Member-fahuo.html";
	document.getElementsByClassName("persontab")[0].children[4].firstChild.href="Member-shouhuo.html";
	document.getElementsByClassName("persontab")[0].children[5].firstChild.href="Member-pinglun.html";



	// 设置个人界面上的当前用户提示信息，隐藏部分信息后展示
	let info = localStorage.getItem("currentLoginUser.aomall.com");
	//info = info.replace(info.substring(3, 7), "****");
	$(".InTitle").html("你正在为（" + info + "）修改密码，请选择身份验证方式：");
	$(".userName").html(info);

	// tab
	function navTab(canshu1,canshu2){
			$(canshu1).hover(function(event) {
				var navNum = $(this).index();
				$(canshu2).eq(navNum).css('display', 'block').siblings(canshu2).css('display', 'none');
				$(this).addClass('current').siblings(canshu1).removeClass('current');
			});
		}
	navTab(".CouponTabW  .CouponTab",".CouponTabarea");
	navTab(".inforAreaTitle .tab",".inforContent .inforContentW");
	// 选框效果
	function CheckBox (ele) {
		this.ele = ele;
		this.init();
	}
	CheckBox.prototype = {
		constructor: CheckBox,
		init: function () {
			this.bindEvent();
		},
		bindEvent: function () {
			this.ele.on('click', function(){
				if ($(this).hasClass('checked')) {
					$(this).removeClass('checked');
				} else{
					$(this).addClass('checked');
				};
			})
		}
	}
	var checkbox = new CheckBox($('.checkbox'));
	// 删除订单
	function del(canshu1,canshu2){
		$(canshu1).click(function(event) {
			$(this).parentsUntil(canshu2).css('display', 'none');
		});
	}
	del(".recentlyListArea .delete","form")
});

function unLoad(){
	localStorage.clear();
	window.location.href = "../login.html";
}

layui.use('layer', function () {
	var layer = layui.layer;
});